<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta http-equiv="refresh" content="120" />
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../css/style.css">
    <script src="../plugins/echarts/echarts.js"></script>

    <script src="../plugins/healthmobile.js"></script>
    <script>
        var leaveTime = getUrlParam("leaveTime");

    </script>
</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>统计分析<small>接口调用</small></h1>

        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>统计分析</el-breadcrumb-item>
            <el-breadcrumb-item>接口调用</el-breadcrumb-item>
            <el-breadcrumb-item><a href="javascript:a();">其他日期</a></el-breadcrumb-item>
        </el-breadcrumb>
        <div id="showMe">

        </div>
    </div>
    <div class="app-container">
        <div class="box">
            <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
            <div id="chart4" style="height:600px;"></div>
        </div>
    </div>
</div>
</body>
<script>
    var a = function(){
        data = '<br>\n' +
            '    <br>\n' +
            '    <form action="report_interface.html"  method="get"  >\n' +
            '        <fieldset>\n' +
            '            <legend>日期选择</legend>\n' +
            '            <label for="leaveTime">请选择您想查看的日期</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n' +
            '            <input type="date" id="leaveTime" name="leaveTime">\n' +
            '            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n' +
            '            <input type="submit" name="" value="确定">\n' +
            '        </fieldset>\n' +
            '    </form>\n' +
            '    <br>';
        document.getElementById("showMe").innerHTML = data;

    }

</script>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart1 = echarts.init(document.getElementById('chart4'));

    // 使用刚指定的配置项和数据显示图表。
    //myChart.setOption(option);

    axios.get("/report/getInterfaceReport.do?leaveTime="+leaveTime).then((res)=>{
        myChart1.setOption(
            {
                title: {
                    text: '当日接口访问统计排行',

                },
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'shadow'
                    }
                },
                legend: {
                    data: res.data.data.calendarDay
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: {
                    type: 'value',
                    boundaryGap: [0, 0.01]
                },
                yAxis: {
                    type: 'category',
                    data: res.data.data.interfaceNames
                },
                series: [

                    {
                        name: res.data.data.calendarDay,
                        type: 'bar',
                        data: res.data.data.interfaceCount
                    }
                ]
            });
    });
</script>
</html>
